package com.feidee.data.email.util.mail;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

public class RMailInfo {
  private String mailServerHost;
  private String mailServerPort = "25";
  private String fromAddress;
  private List<String> toAddress;
  private List<String> ccAddress;
  private List<String> bccAddress;
  private String userName;
  private String password;
  private boolean validate = false; // 是否需要身份验证
  private String subject;
  private String content;
  private List<File> attachFiles;
  private List<Image> images;

  public List<Image> getImages() {
    return images;
  }

  public void setImages(List<Image> images) {
    this.images = images;
  }

  public RMailInfo() {
    toAddress = new ArrayList<String>();
    ccAddress = new ArrayList<String>();
    bccAddress = new ArrayList<String>();
  }


  /**
   * 获得邮件会话属性
   */
  public Properties getProperties() {
    Properties p = new Properties();
    p.put("mail.smtp.host", this.mailServerHost);
    p.put("mail.smtp.port", this.mailServerPort);
    p.put("mail.smtp.auth", validate ? "true" : "false");
//    p.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
//    p.put("mail.smtp.socketFactory.port", "993");
//    p.put("mail.smtp.starttls.enable","true");
    return p;
  }

  public void addToAddress(String address) {
    toAddress.add(address);
  }

  public void addCcAddress(String address) {
    ccAddress.add(address);
  }

  public void addBccAddress(String address) {
    bccAddress.add(address);
  }

  public String getMailServerHost() {
    return mailServerHost;
  }

  public void setMailServerHost(String mailServerHost) {
    this.mailServerHost = mailServerHost;
  }

  public String getMailServerPort() {
    return mailServerPort;
  }

  public void setMailServerPort(String mailServerPort) {
    this.mailServerPort = mailServerPort;
  }

  public String getFromAddress() {
    return fromAddress;
  }

  public void setFromAddress(String fromAddress) {
    this.fromAddress = fromAddress;
  }

  public List<String> getToAddress() {
    return toAddress;
  }

  public void setToAddress(List<String> toAddress) {
    this.toAddress = toAddress;
  }

  public List<String> getCcAddress() {
    return ccAddress;
  }

  public void setCcAddress(List<String> ccAddress) {
    this.ccAddress = ccAddress;
  }

  public List<String> getBccAddress() {
    return bccAddress;
  }

  public void setBccAddress(List<String> bccAddress) {
    this.bccAddress = bccAddress;
  }

  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public boolean isValidate() {
    return validate;
  }

  public void setValidate(boolean validate) {
    this.validate = validate;
  }

  public String getSubject() {
    return subject;
  }

  public void setSubject(String subject) {
    this.subject = subject;
  }

  public String getContent() {
    return content;
  }

  public void setContent(String content) {
    this.content = content;
  }

  public List<File> getAttachFileNames() {
    return attachFiles;
  }

  public void setAttachFileNames(List<File> attachFileNames) {
    this.attachFiles = attachFileNames;
  }
}

